package secondBrush.doubles;


public class E05Leetcode344 {
    public void reverseString(char[] s) {
        int left = 0;
        int right = s.length - 1;
        while (left < right) {
            swap(s, left, right);
            left++;
            right--;
        }



    }

    private void swap(char[] s, int left, int right) {
        char temp = s[left];
        s[left] = s[right];
        s[right] = temp;
    }

    public static void main(String[] args) {
        E05Leetcode344 e05Leetcode344 = new E05Leetcode344();
        char[] s = {'h', 'e', 'l', 'l', 'o'};
        e05Leetcode344.reverseString(s);
    }
}
